﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Computer_Manager.DAL;
using Computer_Manager.DTO;
using DevExpress.XtraEditors;
using System.Windows.Forms;

namespace Computer_Manager.BUS
{
    class BUS_order_detail
    {
        DAL_order_detail dal = new DAL_order_detail();

        public int order_detail_insert(DTO_order_detail obj)
        {
            int id = 0;
            try
            {
                id = dal.order_detail_insert(obj);
            }
            catch (Exception e)
            {

                XtraMessageBox.Show(e.Message, "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return id;

        }

        public void order_detail_Update(DTO_order_detail obj)
        {
            try
            {
                dal.order_detail_Update(obj);
            }
            catch (Exception)
            {

                throw;
            }
        }

        public void order_detail_Delete(DTO_order_detail obj)
        {
            try
            {
                dal.order_detail_Delete(obj);
            }
            catch (Exception)
            {

                throw;
            }
        }

        public DataTable GetByID(DTO_order_detail obj)
        {
            DataTable dt = new DataTable();
            try
            {
                dt = dal.GetByID(obj);
            }
            catch (Exception)
            {

                throw;
            }
            return dt;
        }
        public DataTable GetByOrderID(DTO_order_detail obj)
        {
            DataTable dt = new DataTable();
            try
            {
                dt = dal.GetByOrderID(obj);
            }
            catch (Exception)
            {

                throw;
            }
            return dt;
        }

        public DataTable GetByProductId(DTO_order_detail obj)
        {
            DataTable dt = new DataTable();
            try
            {
                dt = dal.GetByProductId(obj);
            }
            catch (Exception)
            {

                throw;
            }
            return dt;
        }


        public DataTable GetAll()
        {
            DataTable dt = new DataTable();
            try
            {
                dt = dal.GetAll();

            }
            catch (Exception)
            {

                throw;
            }
            return dt;
        }
    }
}
